n,S=map(int,input().split())

a=list(map(int,input().split()))

# 找最短区间满足区间之和>=s

min_len=n+1
# [left,right)
left,right=0,0
# tot表示滑动窗口[left,right)之间的区间和
tot=0
while left<n:
    while right<n and tot<S:
        tot+=a[right]
        right+=1
    if tot >=S:
        # [left, right)
        min_len=min(min_len,right-left)
    # 左端点往右走一步
    tot-=a[left]
    left+=1
    
if min_len==n+1:
    min_len=0